package org.example.service;

import org.springframework.stereotype.Service;

@Service("transferService")
public class TransferService02 {
    // 转账
    public void transfer(String accountFrom, String accountTo, Integer amount) {
        if (amount < 1) {
            throw new NullPointerException("转账金额错误 !!!");
        }
        System.out.printf("转账业务：账户 %s 向账户 %s 转账 %d 元 \n", accountFrom, accountTo, amount);
    }

    // 查询余额
    public Integer getBalance(String account) {
        System.out.printf("查询业务：账户 %s 当前余额 1000 元 \n", account);
        return 1000;
    }

    // 提款
    public Integer withdrawal(String account, Integer amount) {
        System.out.printf("提款业务：账户 %s 取出 %d 元 \n", account, amount);
        return amount;
    }

    // 存款
    public void deposit(String account, Integer amount) {
        System.out.printf("存款业务：账户 %s 存入 %d 元 \n", account, amount);
    }
}